xen-watchdog: Move init script to OS-dep dir and implement for netbsd
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 9 Jun 2010 12:29:22 +0000 (13:29 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 9 Jun 2010 12:29:22 +0000 (13:29 +0100)
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/hotplug/Linux/Makefile
tools/hotplug/Linux/init.d/xen-watchdog [new file with mode: 0644]
tools/hotplug/NetBSD/Makefile
tools/hotplug/NetBSD/rc.d/xen-watchdog [new file with mode: 0644]
tools/misc/Makefile
tools/misc/xen-watchdog [deleted file]

index 99749fae897ff39da5da6c5fbfb986e3cfefcda8..19d88ab87d6e61520c4f1fa4aa77d579b8b44885 100644 (file)
@@ -71,6 +71,7 @@ install-initd:
        $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains
        $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
        $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xencommons
+       $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(CONFIG_DIR)/init.d
 
 .PHONY: install-scripts
 install-scripts:
diff --git a/tools/hotplug/Linux/init.d/xen-watchdog b/tools/hotplug/Linux/init.d/xen-watchdog
new file mode 100644 (file)
index 0000000..417b451
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/bash
+#
+# xen-watchdog
+#
+# chkconfig: 2345 21 79
+# description: Run domain watchdog daemon
+#
+
+# Source function library.
+. /etc/init.d/functions
+
+start() {
+       local r
+       base="watchdogd"
+       echo -n $"Starting domain watchdog daemon: "
+
+       /usr/sbin/xenwatchdogd 30 15
+       r=$?
+       [ "$r" -eq 0 ] && success $"$base startup" || failure $"$base startup"
+       echo
+
+       return $r
+}
+
+stop() {
+       local r
+       base="watchdogd"
+       echo -n $"Stopping domain watchdog daemon: "
+
+       killall -USR1 watchdogd 2>/dev/null
+       r=$?
+       [ "$r" -eq 0 ] && success $"$base stop" || failure $"$base stop"
+       echo
+
+       return $r
+}
+
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  status)
+       ;;
+  condrestart)
+       stop
+       start
+       ;;
+  *)
+       echo $"Usage: $0 {start|stop|status|restart|condrestart}"
+       exit 1
+esac
+
index cd683047511ffc79caca06de3aa758b57f34e4ab..98c1c5bbd4868aad7ad819dd5438027581636c30 100644 (file)
@@ -8,7 +8,7 @@ XEN_SCRIPTS += vif-bridge
 XEN_SCRIPTS += vif-ip
 
 XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains
+XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains rc.d/xen-watchdog
 
 .PHONY: all
 all:
diff --git a/tools/hotplug/NetBSD/rc.d/xen-watchdog b/tools/hotplug/NetBSD/rc.d/xen-watchdog
new file mode 100644 (file)
index 0000000..ff4a52c
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# PROVIDE: xen-watchdog
+# REQUIRE: DAEMON
+#
+# description: Run domain watchdog daemon
+#
+
+. /etc/rc.subr
+
+DIR=$(dirname "$0")
+. "${DIR}/xen-hotplugpath.sh"
+
+LD_LIBRARY_PATH="${LIBDIR}"
+export LD_LIBRARY_PATH
+
+name="xenwatchdog"
+rcvar=$name
+command="${SBINDIR}/xenwatchdogd"
+start_cmd="echo Starting ${name}. && PATH=${PATH}:${SBINDIR} ${command} 30 15"
+
+load_rc_config $name
+run_rc_command "$1"
index f8709562e2597f831ce397871d16ece15ce723b0..843de9d3ec8aa99efb0bfdc1b78295cee86d495e 100644 (file)
@@ -41,10 +41,6 @@ install: build
        $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
        $(INSTALL_PYTHON_PROG) $(INSTALL_BIN) $(DESTDIR)$(BINDIR)
        $(INSTALL_PYTHON_PROG) $(INSTALL_SBIN) $(DESTDIR)$(SBINDIR)
-ifeq ($(CONFIG_Linux),y)
-       $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d
-       $(INSTALL_PROG) xen-watchdog $(DESTDIR)$(CONFIG_DIR)/init.d
-endif
        set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install-recurse; done
 
 .PHONY: clean
diff --git a/tools/misc/xen-watchdog b/tools/misc/xen-watchdog
deleted file mode 100644 (file)
index 417b451..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#! /bin/bash
-#
-# xen-watchdog
-#
-# chkconfig: 2345 21 79
-# description: Run domain watchdog daemon
-#
-
-# Source function library.
-. /etc/init.d/functions
-
-start() {
-       local r
-       base="watchdogd"
-       echo -n $"Starting domain watchdog daemon: "
-
-       /usr/sbin/xenwatchdogd 30 15
-       r=$?
-       [ "$r" -eq 0 ] && success $"$base startup" || failure $"$base startup"
-       echo
-
-       return $r
-}
-
-stop() {
-       local r
-       base="watchdogd"
-       echo -n $"Stopping domain watchdog daemon: "
-
-       killall -USR1 watchdogd 2>/dev/null
-       r=$?
-       [ "$r" -eq 0 ] && success $"$base stop" || failure $"$base stop"
-       echo
-
-       return $r
-}
-
-case "$1" in
-  start)
-       start
-       ;;
-  stop)
-       stop
-       ;;
-  restart)
-       stop
-       start
-       ;;
-  status)
-       ;;
-  condrestart)
-       stop
-       start
-       ;;
-  *)
-       echo $"Usage: $0 {start|stop|status|restart|condrestart}"
-       exit 1
-esac
-